<!DOCTYPE html>
<html lang="en">
<head>
    <title>资金日报列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">
    <style type="text/css">
        .leftFilter {
            float: left;
            text-align: left;
            margin-right: 5px;
        }

        .clickable {
            color: #489EF1;;
            cursor: pointer;
            text-align: left;
            font-weight: bold;
        }
        .content {
            padding: 8px 8px 0 8px;
        }
    </style>
</head>
<body>
<section class="content" id="list">
    <div style="text-align:right;padding-bottom: 10px; height: 35px;">
        <input class="pull-left form-control pull-left input-sm" type="text" v-model="time"
               @focus="showDatePicker($event)" placeholder="请选择时间" style="width: 150px;">
        <button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="search()">查询
        </button>
    </div>
    <div class="box-body no-padding iframeH3" style="overflow: auto;background: #fff;border-top: 1px solid #cbcbcd;
    border-bottom: 1px solid #cbcbcd">
        <table class="table table-hover" style="margin: -1px 0">
            <thead>
            <tr>
                <th style="width:100px;text-align: center" class="tableTitle">公司名称</th>
                <th style="width:100px;text-align: right" class="tableTitle">银承昨日余额</th>
                <th style="width:100px;text-align: right" class="tableTitle">银承当天收入</th>
                <th style="width:100px;text-align: right" class="tableTitle">银承当天支出</th>
                <th style="width:100px;text-align: right" class="tableTitle">银承当天余额</th>
                <th style="width:102px;text-align: right" class="tableTitle">昨天可用现金余额</th>
                <th style="width:100px;text-align: right" class="tableTitle">当天现金收入</th>
                <th style="width:100px;text-align: right" class="tableTitle">当天现金支出</th>
                <th style="width:102px;text-align: right" class="tableTitle">今日可用现金余额</th>
                <th style="width:100px;text-align: right" class="tableTitle">专户余额</th>
                <th style="width:100px;text-align: right" class="tableTitle">POS机未到余额</th>
                <th style="width:100px;text-align: right" class="tableTitle">现金+P未到账</th>
            </tr>
            </thead>
            <tbody style="text-align: right">
            <tr v-for="(item, index) in list">
                <template v-if="item.companyName.indexOf('大客户')>-1"></template>
                <template v-else>
                    <td style="text-align: center;color:#169BD5;cursor: pointer"
                        @click="lookRegionList(item.companyId,item.companyName)">{{item.companyName}}
                    </td>
                    <td>{{item.yestdayDebits?fmoney(item.yestdayDebits):"-"}}</td>
                    <td>{{item.debitsDayIncome?fmoney(item.debitsDayIncome):"-"}}</td>
                    <td>{{item.debitsDayExpenditure?fmoney(item.debitsDayExpenditure):"-"}}</td>
                    <td>{{item.currentDebits?fmoney(item.currentDebits):"-"}}</td>
                    <td>{{item.yestdayMoney?fmoney(item.yestdayMoney):"-"}}</td>
                    <td>{{item.dayIncome?fmoney(item.dayIncome):"-"}}</td>
                    <td>{{item.dayExpenditure?fmoney(item.dayExpenditure):"-"}}</td>
                    <td>{{item.currentMoney?fmoney(item.currentMoney):"-"}}</td>
                    <td>{{item.VCEMoney?fmoney(item.VCEMoney):"-"}}</td>
                    <td>{{item.POSMoney?fmoney(item.POSMoney):"-"}}</td>
                    <td>{{item.CPlusP?fmoney(item.CPlusP):"-"}}</td>
                </template>
            </tr>
            <tr style="font-weight: bold;text-align: right">
                <td style="text-align: center;">滚滚向前小计</td>
                <td>{{fmoney(newTotalData.yestdayDebits)}}</td>
                <td>{{fmoney(newTotalData.debitsDayIncome)}}</td>
                <td>{{fmoney(newTotalData.debitsDayExpenditure)}}</td>
                <td style="color: #FF0000">{{fmoney(newTotalData.currentDebits)}}</td>
                <td>{{fmoney(newTotalData.yestdayMoney)}}</td>
                <td>{{fmoney(newTotalData.dayIncome)}}</td>
                <td>{{fmoney(newTotalData.dayExpenditure)}}</td>
                <td style="color: #FF0000">{{fmoney(newTotalData.currentMoney)}}</td>
                <td>{{fmoney(newTotalData.VCEMoney)}}</td>
                <td>{{fmoney(newTotalData.POSMoney)}}</td>
                <td>{{fmoney(newTotalData.CPlusP)}}</td>
            </tr>
            <tr v-for="(item, index) in list2">
                <template v-if="item.companyName.indexOf('大客户')>-1"></template>
                <template v-else>
                    <td style="text-align: center;color:#169BD5;cursor: pointer"
                        @click="lookRegionList(item.companyId,item.companyName)">{{item.companyName}}
                    </td>
                    <td>{{item.yestdayDebits?fmoney(item.yestdayDebits):"-"}}</td>
                    <td>{{item.debitsDayIncome?fmoney(item.debitsDayIncome):"-"}}</td>
                    <td>{{item.debitsDayExpenditure?fmoney(item.debitsDayExpenditure):"-"}}</td>
                    <td>{{item.currentDebits?fmoney(item.currentDebits):"-"}}</td>
                    <td>{{item.yestdayMoney?fmoney(item.yestdayMoney):"-"}}</td>
                    <td>{{item.dayIncome?fmoney(item.dayIncome):"-"}}</td>
                    <td>{{item.dayExpenditure?fmoney(item.dayExpenditure):"-"}}</td>
                    <td>{{item.currentMoney?fmoney(item.currentMoney):"-"}}</td>
                    <td>{{item.VCEMoney?fmoney(item.VCEMoney):"-"}}</td>
                    <td>{{item.POSMoney?fmoney(item.POSMoney):"-"}}</td>
                    <td>{{item.CPlusP?fmoney(item.CPlusP):"-"}}</td>
                </template>
            </tr>
            <tr style="font-weight: bold;text-align: right">
                <td style="text-align: center;">沃源小计</td>
                <td>{{fmoney(new2TotalData.yestdayDebits)}}</td>
                <td>{{fmoney(new2TotalData.debitsDayIncome)}}</td>
                <td>{{fmoney(new2TotalData.debitsDayExpenditure)}}</td>
                <td style="color: #FF0000">{{fmoney(new2TotalData.currentDebits)}}</td>
                <td>{{fmoney(new2TotalData.yestdayMoney)}}</td>
                <td>{{fmoney(new2TotalData.dayIncome)}}</td>
                <td>{{fmoney(new2TotalData.dayExpenditure)}}</td>
                <td style="color: #FF0000">{{fmoney(new2TotalData.currentMoney)}}</td>
                <td>{{fmoney(new2TotalData.VCEMoney)}}</td>
                <td>{{fmoney(new2TotalData.POSMoney)}}</td>
                <td>{{fmoney(new2TotalData.CPlusP)}}</td>
            </tr>
            <tr style="font-weight: bold;text-align: right">
                <td style="text-align: center;">总计</td>
                <td>{{fmoney(totalData.yestdayDebits)}}</td>
                <td>{{fmoney(totalData.debitsDayIncome)}}</td>
                <td>{{fmoney(totalData.debitsDayExpenditure)}}</td>
                <td style="color: #FF0000">{{fmoney(totalData.currentDebits)}}</td>
                <td>{{fmoney(totalData.yestdayMoney)}}</td>
                <td>{{fmoney(totalData.dayIncome)}}</td>
                <td>{{fmoney(totalData.dayExpenditure)}}</td>
                <td style="color: #FF0000">{{fmoney(totalData.currentMoney)}}</td>
                <td>{{fmoney(totalData.VCEMoney)}}</td>
                <td>{{fmoney(totalData.POSMoney)}}</td>
                <td>{{fmoney(totalData.CPlusP)}}</td>
            </tr>

            </thead>
        </table>
    </div>
    <!--<div class="oa-pager text-center">-->
    <!--共<span id="allCount">{{recordCount}}</span>条记录&nbsp;&nbsp;&nbsp;-->
    <!--<span id="nowPage">{{pageIndex}}</span>/<span id="allPage">{{pageCount}}</span>&nbsp;&nbsp;&nbsp;-->
    <!--<span id="first" class="oa-pager-button" @click="pagination('first')">首页</span>-->
    <!--<span id="prev" class="oa-pager-button" @click="pagination('pre')">上一页</span>-->
    <!--<span id="next" class="oa-pager-button" @click="pagination('next')">下一页</span>-->
    <!--<span id="last" class="oa-pager-button" @click="pagination('last')">尾页</span>-->
    <!--</div>-->
    <!-- /.box-body -->
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=
54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript" src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript">
    Vue.directive('select2', {
        inserted: function (el, binding, vnode) {
            var options = binding.value || {};

            $(el).select2(options).on("select2:select", function (e) {
                el.dispatchEvent(new Event('change', {target: e.target})); //说好的双向绑定，竟然不安套路
            });
        },
        update: function (el, binding, vnode) {
            $(el).trigger("change");
        }
    });
    var app = new Vue({
        el: '#list',
        data: {
            currentUser: getCurrentUser(),
            pageIndex: 1,
            pageCount: 1,
            recordCount: 1,
            list: [],
            list2: [],
            totalData: {
                currentMoney: 0,
                dayIncome: 0,
                dayExpenditure: 0,
                yestdayMoney: 0,
                debitsDayIncome: 0,
                debitsDayExpenditure: 0,
                currentDebits: 0,
                yestdayDebits: 0,
                VCEMoney: 0,
                POSMoney: 0,
                CPlusP: 0,
                allTwo: []
            },
            newTotalData: {
                currentMoney: 0,
                dayIncome: 0,
                dayExpenditure: 0,
                yestdayMoney: 0,
                debitsDayIncome: 0,
                debitsDayExpenditure: 0,
                currentDebits: 0,
                yestdayDebits: 0,
                VCEMoney: 0,
                POSMoney: 0,
                CPlusP: 0
            },
            new2TotalData: {
                currentMoney: 0,
                dayIncome: 0,
                dayExpenditure: 0,
                yestdayMoney: 0,
                debitsDayIncome: 0,
                debitsDayExpenditure: 0,
                currentDebits: 0,
                yestdayDebits: 0,
                VCEMoney: 0,
                POSMoney: 0,
                CPlusP: 0
            },
            time: new Date().Format("yyyy-MM-dd"),
            PerES: false
        },
        methods: {
            fmoney: function (s, n) {
                n = n > 0 && n <= 0 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
            rmoney: function (s) {
                if (s == 0)
                    return 0;
                else
                    return parseFloat(s.replace(/[^\d\.-]/g, ""));
            },
            initData: function () {
                var that = this;
                var listOne = [];
                var listTwo = [];
                that.totalData = {
                    currentMoney: 0,
                    dayIncome: 0,
                    dayExpenditure: 0,
                    yestdayMoney: 0,
                    debitsDayIncome: 0,
                    debitsDayExpenditure: 0,
                    currentDebits: 0,
                    yestdayDebits: 0,
                    VCEMoney: 0,
                    POSMoney: 0,
                    CPlusP: 0,
                    allTwo: []
                }
                that.newTotalData = {
                    currentMoney: 0,
                    dayIncome: 0,
                    dayExpenditure: 0,
                    yestdayMoney: 0,
                    debitsDayIncome: 0,
                    debitsDayExpenditure: 0,
                    currentDebits: 0,
                    yestdayDebits: 0,
                    VCEMoney: 0,
                    POSMoney: 0,
                    CPlusP: 0,
                    allTwo: []
                }
                that.new2TotalData = {
                    currentMoney: 0,
                    dayIncome: 0,
                    dayExpenditure: 0,
                    yestdayMoney: 0,
                    debitsDayIncome: 0,
                    debitsDayExpenditure: 0,
                    currentDebits: 0,
                    yestdayDebits: 0,
                    VCEMoney: 0,
                    POSMoney: 0,
                    CPlusP: 0,
                    allTwo: []
                }
                $.wyui.postMethod("/reportCapital/getCapitalTotal.json", {'date': that.time}, function (r) {
                    for (var b = 0; b < r.length; b++) {
                        if (r[b].companyName == "滚滚向前集团") {
                            r.splice(b, 1);
                        }
                    }
                    that.list = r;

                    for (var c = 0; c < r.length; c++) {
                        listOne.push(r[c])
                    }


                    //获取其他4省报表
                    $.ajax({
                        url: "http://60.205.143.20:5758/FundWS.asmx/GetFundListAll?jsoncallback=?",
                        dataType: "jsonp",
                        jsonp: "jsoncallback",
                        async: true,
                        data: {date: that.time},
                        success: function (data) {
                            console.log(data);
                            for (var i = 0; i < data.length - 1; i++) {
                                var newList = {};
                                newList.companyName = data[i].provinceName;
                                newList.yestdayDebits = data[i].YesterUNacpDraMoney;
                                newList.debitsDayIncome = data[i].DAYCYI;
                                newList.debitsDayExpenditure = data[i].DAYCYO;
                                newList.currentDebits = data[i].UNacpDraMoney;
                                newList.yestdayMoney = data[i].acpDraMoney;
                                newList.dayIncome = data[i].DAYIN;
                                newList.dayExpenditure = data[i].DAYOUT;
                                newList.currentMoney = data[i].CashSurplus;
                                newList.VCEMoney = data[i].vceBalance;
                                newList.POSMoney = data[i].unCashSurplus;
                                newList.CPlusP = data[i].CashCount;
                                listOne.push(newList)
                                listTwo.push(newList)

                                that.new2TotalData.currentMoney = Number(that.new2TotalData.currentMoney) + Number(newList.currentMoney);
                                that.new2TotalData.dayIncome = Number(that.new2TotalData.dayIncome) + Number(newList.dayIncome);
                                that.new2TotalData.dayExpenditure = Number(that.new2TotalData.dayExpenditure) + Number(newList.dayExpenditure);
                                that.new2TotalData.yestdayMoney = Number(that.new2TotalData.yestdayMoney) + Number(newList.yestdayMoney);
                                that.new2TotalData.debitsDayIncome = Number(that.new2TotalData.debitsDayIncome) + Number(newList.debitsDayIncome);
                                that.new2TotalData.debitsDayExpenditure = Number(that.new2TotalData.debitsDayExpenditure) + Number(newList.debitsDayExpenditure);
                                that.new2TotalData.currentDebits = Number(that.new2TotalData.currentDebits) + Number(newList.currentDebits);
                                that.new2TotalData.yestdayDebits = Number(that.new2TotalData.yestdayDebits) + Number(newList.yestdayDebits);
                                that.new2TotalData.VCEMoney = Number(that.new2TotalData.VCEMoney) + Number(newList.VCEMoney);
                                that.new2TotalData.POSMoney = Number(that.new2TotalData.POSMoney) + Number(newList.POSMoney);
                                that.new2TotalData.CPlusP = Number(that.new2TotalData.CPlusP) + Number(newList.CPlusP);
                            }
                            that.list2 = listTwo;
                            that.allTwo = data[4];
                            console.log(listOne.length)
                            for (var a = 0; a < listOne.length; a++) {
                                var reportData = listOne[a];
                                if (a < listOne.length - 4) {
                                    that.totalData.currentMoney = Number(that.totalData.currentMoney) + Number(reportData.currentMoney);
                                    that.totalData.dayIncome = Number(that.totalData.dayIncome) + Number(reportData.dayIncome);
                                    that.totalData.dayExpenditure = Number(that.totalData.dayExpenditure) + Number(reportData.dayExpenditure);
                                    that.totalData.yestdayMoney = Number(that.totalData.yestdayMoney) + Number(reportData.yestdayMoney);
                                    that.totalData.debitsDayIncome = Number(that.totalData.debitsDayIncome) + Number(reportData.debitsDayIncome);
                                    that.totalData.debitsDayExpenditure = Number(that.totalData.debitsDayExpenditure) + Number(reportData.debitsDayExpenditure);
                                    that.totalData.currentDebits = Number(that.totalData.currentDebits) + Number(reportData.currentDebits);
                                    that.totalData.yestdayDebits = Number(that.totalData.yestdayDebits) + Number(reportData.yestdayDebits);
                                    that.totalData.VCEMoney = Number(that.totalData.VCEMoney) + Number(reportData.VCEMoney);
                                    that.totalData.POSMoney = Number(that.totalData.POSMoney) + Number(reportData.POSMoney);
                                    that.totalData.CPlusP = Number(that.totalData.CPlusP) + Number(reportData.CPlusP);

                                    that.newTotalData.currentMoney = Number(that.newTotalData.currentMoney) + Number(reportData.currentMoney);
                                    that.newTotalData.dayIncome = Number(that.newTotalData.dayIncome) + Number(reportData.dayIncome);
                                    that.newTotalData.dayExpenditure = Number(that.newTotalData.dayExpenditure) + Number(reportData.dayExpenditure);
                                    that.newTotalData.yestdayMoney = Number(that.newTotalData.yestdayMoney) + Number(reportData.yestdayMoney);
                                    that.newTotalData.debitsDayIncome = Number(that.newTotalData.debitsDayIncome) + Number(reportData.debitsDayIncome);
                                    that.newTotalData.debitsDayExpenditure = Number(that.newTotalData.debitsDayExpenditure) + Number(reportData.debitsDayExpenditure);
                                    that.newTotalData.currentDebits = Number(that.newTotalData.currentDebits) + Number(reportData.currentDebits);
                                    that.newTotalData.yestdayDebits = Number(that.newTotalData.yestdayDebits) + Number(reportData.yestdayDebits);
                                    that.newTotalData.VCEMoney = Number(that.newTotalData.VCEMoney) + Number(reportData.VCEMoney);
                                    that.newTotalData.POSMoney = Number(that.newTotalData.POSMoney) + Number(reportData.POSMoney);
                                    that.newTotalData.CPlusP = Number(that.newTotalData.CPlusP) + Number(reportData.CPlusP);
                                } else {
                                    that.totalData.currentMoney = Number(that.totalData.currentMoney) + Number(reportData.currentMoney);
                                    that.totalData.dayIncome = Number(that.totalData.dayIncome) + Number(reportData.dayIncome);
                                    that.totalData.dayExpenditure = Number(that.totalData.dayExpenditure) + Number(reportData.dayExpenditure);
                                    that.totalData.yestdayMoney = Number(that.totalData.yestdayMoney) + Number(reportData.yestdayMoney);
                                    that.totalData.debitsDayIncome = Number(that.totalData.debitsDayIncome) + Number(reportData.debitsDayIncome);
                                    that.totalData.debitsDayExpenditure = Number(that.totalData.debitsDayExpenditure) + Number(reportData.debitsDayExpenditure);
                                    that.totalData.currentDebits = Number(that.totalData.currentDebits) + Number(reportData.currentDebits);
                                    that.totalData.yestdayDebits = Number(that.totalData.yestdayDebits) + Number(reportData.yestdayDebits);
                                    that.totalData.VCEMoney = Number(that.totalData.VCEMoney) + Number(reportData.VCEMoney);
                                    that.totalData.POSMoney = Number(that.totalData.POSMoney) + Number(reportData.POSMoney);
                                    that.totalData.CPlusP = Number(that.totalData.CPlusP) + Number(reportData.CPlusP);
                                }

                            }
                        },
                        error: function (e) {
                            alert(e.responseText);
                        }
                    });


                });
            },
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.time = dp.cal.getNewDateStr();
                        return true;
                    },
                    //dateFmt:'yyyy-MM-dd HH:mm'
                });
                $(e.target).blur();
            },
            search: function () {
                this.initData();
            },
            lookRegionList: function (companyId, companyName) {
                if (companyId) {
                    var that = this;
                    top.closeTabByPageId("capitalDetail");
                    url = "reportForm/capital/fundsDayDetail.html?type=report&companyId=" + companyId + "&time=" + that.time;
                    top.addTabs({id: "capitalDetail", title: "资金日报详情", close: true, url: url});
                } else {
                    var that = this;
                    top.closeTabByPageId("capitalDetail");
                    url = "reportForm/capital/fundsDayDetailTwo.html?type=report&companyName=" + companyName + "&time=" + that.time;
                    top.addTabs({id: "capitalDetail", title: "资金日报详情", close: true, url: url});
                }

            }
        },

        mounted: function () {
            this.initData();
            var that = this;

        }
    });


</script>



</body>
</html>